package cn.z2huo.knowledge.collection.map.hashmap;

import java.util.HashMap;

class NullKeyHashCodeTest {

    public static void main(String[] args) {
        // Map.of 方法的键是不能为 null 的
//        Map<Object, String> map = Map.of(null, "value");
//        HashMap<Object, String> hashMap = new HashMap<>(map);

        HashMap<Object, String> hashMap = new HashMap<>();
        hashMap.put(null, "value");
        System.out.println(hashMap.get(null));

        for (Object key : hashMap.keySet()) {
            System.out.println(key.hashCode());
        }
    }

}
